/* -------------------------------------------------------------------------- *\
 * Necessary styling for the dialog to work
 * -------------------------------------------------------------------------- */

.dialog[aria-hidden='true'] {
  display: none;
}

/* -------------------------------------------------------------------------- *\
 * Styling to make the dialog look like a dialog
 * -------------------------------------------------------------------------- */

.dialog,
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 2;
}

.dialog {
  display: flex;
}

.dialog-overlay {
  background-color: rgba(43, 46, 56, 0.9);
}

.dialog-content {
  background-color: rgb(255, 255, 255);
  margin: auto;
  z-index: 2;
  position: relative;
}

/* -------------------------------------------------------------------------- *\
 * Extra dialog styling to make it shiny
 * -------------------------------------------------------------------------- */

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(10%);
  }
}

.dialog-overlay {
  animation: fade-in 200ms both;
}

.dialog-content {
  animation:
    fade-in 400ms 200ms both,
    slide-up 400ms 200ms both;
}

.dialog-content {
  padding: 1em;
  max-width: 90%;
  width: 600px;
  border-radius: 2px;
}

@media screen and (min-width: 700px) {
  .dialog-content {
    padding: 2em;
  }
}

.dialog h1 {
  margin: 0;
  font-size: 1.25em;
}

.dialog-close {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  border: 0;
  padding: 0;
  background-color: transparent;
  font-weight: bold;
  font-size: 1.25em;
  width: 1.2em;
  height: 1.2em;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  .dialog-close {
    transition: none;
  }
  .dialog-content {
    animation: none;
  }
}

@media screen and (min-width: 700px) {
  .dialog-close {
    top: 1em;
    right: 1em;
  }
}

/* -------------------------------------------------------------------------- *\
 * Base stuff
 * -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

body {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  font:
    125% / 1.5 -apple-system,
    BlinkMacSystemFont,
    Segoe UI,
    Helvetica,
    Arial,
    sans-serif;
  gap: 1em;
  padding: 2em 0;
}

h1 {
  font-size: 1.6em;
  line-height: 1.1;
}

h1 span {
  color: #e50050;
}

h1,
h2 {
  margin-bottom: 0;
}

.link-like,
a {
  color: #2984c2;
}

.link-like:hover,
.link-like:active,
a:hover,
a:active {
  color: #e50050;
}

fancy-button.dialog-close::part(root) {
  background-color: transparent;
  border: none;
  color: black;
  font-weight: bold;
  padding-inline: 0.25em;
}
fancy-div {
  background-color: #e0e0e0;
  border-radius: 4px;
  margin-top: 0.5em;
  padding: 0.25em 0.75em;
}
fancy-div:focus {
  outline: 2px solid tomato;
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------- *\
 * Helpers
 * -------------------------------------------------------------------------- */

.link-like {
  background-color: transparent;
  text-decoration: underline;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* -------------------------------------------------------------------------- *\
 * Layout
 * -------------------------------------------------------------------------- */

main {
  align-items: flex-start;
  display: flex;
  flex-basis: 100%;
  flex-direction: column;
  gap: 0.5em;
  margin: 0;
  padding: 0 1em;
}

footer {
  border-top: 1px solid silver;
  padding: 20px 0;
}

/* -------------------------------------------------------------------------- *\
 * Form styling
 * -------------------------------------------------------------------------- */

form {
  margin-top: 2em;
  position: relative;
}

@media screen and (min-width: 700px) {
  form {
    display: flex;
  }
}

form label {
  font-weight: bold;
  margin: 5px 10px 5px 0;
  vertical-align: middle;
}

form input {
  font: inherit;
  padding: 0.25em;
  border: 1px solid silver;
  width: 100%;
  margin: 0.25em 0 1em;
}

@media screen and (min-width: 700px) {
  form input {
    flex: 1;
    border-right: 0;
    width: auto;
    margin: 0;
  }
}

form button {
  background-color: #81c784;
  color: white;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  padding: 8px 15px;
  cursor: pointer;
  transition: 0.15s;
  display: inline-block;
}

form button:hover,
form button:active {
  background-color: #66bb6a;
}

[popovertarget] {
  border: 1px solid #00f;
  background-color: #00f;
  font-weight: bold;
  font-size: 125%;
  line-height: 0;
  color: #fff;
  border-radius: 50%;
  display: inline-block;
  width: 1em;
  height: 1em;
  margin: 0;
  padding: 0;
}

[popovertarget]:focus,
[popovertarget]:hover {
  color: #00f;
  background-color: #ff0;
}

[popover] {
  background-color: #ff9;
  padding: 0.5em 1em;
  max-width: 12.5em;
  font-weight: normal;
  position: absolute;
  left: 2em;
  top: 13.5em;
  border: 1px solid #cc0;
  border-radius: 0.25em;
  box-shadow: 0 0 0.5em #333;
}
